person.counts <- with(dfPost,tapply(sooind_id,list(treat,girl,hgc0),function(x){length(unique(x))}))
dimnames(person.counts)[[1]] <-c("Control","Treated")
dimnames(person.counts)[[2]] <-c("Boys","Girls")
Grade <- as.factor(rep(c(1:10),2))
Group <- c(rep(" Control", 10), rep("Treated", 10))
numbers.boys <- matrix(c(person.counts[1,1,],person.counts[2,1,]), nrow = 20, ncol = 1)
numbers.girls<- matrix(c(person.counts[1,2,],person.counts[2,2,]), nrow = 20, ncol = 1)
tab.boys <- data.frame(Grade, Group, numbers.boys)
tab.girls <- data.frame(Grade, Group, numbers.girls)
plot.n.boys <- ggplot(tab.boys, aes(x = Grade, y = numbers.boys, fill = Group)) +
geom_col(width = 0.7, position = position_dodge(width=0.8)) +
theme_bw(base_size = 11) +
theme(legend.position = "bottom", legend.title = element_blank()) +
scale_y_continuous(limits=c(0,1100),breaks = seq(from = 0, to = 1100, by = 100)) +
xlab("Baseline Grade Level") +
ylab("Number of Boy Observations")+
ggtitle("Number of Boy Observations, Treated and Control")
plot.n.girls <- ggplot(tab.girls, aes(x = Grade, y = numbers.girls, fill = Group)) +
geom_col(width = 0.7, position = position_dodge(width=0.8)) +
theme_bw(base_size = 11) +
theme(legend.position = "bottom", legend.title = element_blank()) +
scale_y_continuous(limits=c(0,1100),breaks = seq(from = 0, to = 1100, by = 100)) +
xlab("Baseline Grade Level") +
ylab("Number of Girl Observations")+
ggtitle("Number of Girl Observations, Treated and Control")
village.counts <- with(dfPost,tapply(sooloca,list(treat,girl,hgc0),function(x){length(unique(x))}))
dimnames(village.counts)[[1]] <-c("Control","Treated")
dimnames(village.counts)[[2]] <-c("Boys","Girls")
numbers.boys.v <- matrix(c(village.counts[1,1,],village.counts[2,1,]), nrow = 20, ncol = 1)
numbers.girls.v<- matrix(c(village.counts[1,2,],village.counts[2,2,]), nrow = 20, ncol = 1)
tab.boys.v <- data.frame(Grade, Group, numbers.boys.v)
tab.girls.v <- data.frame(Grade, Group, numbers.girls.v)
plot.n.boys.v <- ggplot(tab.boys.v, aes(x = Grade, y = numbers.boys.v, fill = Group)) +
geom_col(width = 0.7, position = position_dodge(width=0.8)) +
theme_bw(base_size = 11) +
theme(legend.position = "bottom", legend.title = element_blank()) +
scale_y_continuous(limits=c(0,1100),breaks = seq(from = 0, to = 1100, by = 100)) +
xlab("Baseline Grade Level") +
ylab("Number of Villages with Boy Observations")+
ggtitle("Number of Villages with Boy Observations")
plot.n.girls.v <- ggplot(tab.girls.v, aes(x = Grade, y = numbers.girls.v, fill = Group)) +
geom_col(width = 0.7, position = position_dodge(width=0.8)) +
theme_bw(base_size = 11) +
theme(legend.position = "bottom", legend.title = element_blank()) +
scale_y_continuous(limits=c(0,1100),breaks = seq(from = 0, to = 1100, by = 100)) +
xlab("Baseline Grade Level") +
ylab("Number of Villages with Girl Observations")+
ggtitle("Number of Villages with Girl Observations")